<?php

/**
 * This is the model class for table "tpagos".
 *
 * The followings are the available columns in table 'tpagos':
 * @property integer $cod_paciente
 * @property integer $nro_cita
 * @property string $fecha_cita
 * @property integer $fecha_pago
 * @property double $valor_pagado
 * @property integer $PK_Tpagos
 */
class Pagos extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Pagos the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tpagos';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('cod_paciente, nro_cita, fecha_pago, PK_Tpagos', 'numerical', 'integerOnly'=>true),
			array('valor_pagado', 'numerical'),
			array('fecha_cita', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('cod_paciente, nro_cita, fecha_cita, fecha_pago, valor_pagado, PK_Tpagos', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'cod_paciente' => 'Paciente',
			'nro_cita' => 'Cita',
			'fecha_cita' => 'Fecha Cita',
			'fecha_pago' => 'Fecha Pago',
			'valor_pagado' => 'Valor Pagado',
			'PK_Tpagos' => 'ID',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('cod_paciente',$this->cod_paciente);
		$criteria->compare('nro_cita',$this->nro_cita);
		$criteria->compare('fecha_cita',$this->fecha_cita,true);
		$criteria->compare('fecha_pago',$this->fecha_pago);
		$criteria->compare('valor_pagado',$this->valor_pagado);
		$criteria->compare('PK_Tpagos',$this->PK_Tpagos);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}